<%--
  Created by IntelliJ IDEA.
  User: FENG1
  Date: 2022-05-25
  Time: 10:30
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath() + "/";%>
<html>
<head>
    <base href="<%=basePath%>">
    <title>支付打印单</title>
    <link rel="stylesheet" href="static/component/pear/css/pear.css" />
    <script src="static/component/layui/layui.js"></script>
    <script src="static/component/pear/pear.js"></script>
    <script language="javascript">
        function preview(oper)
        {
            if (oper < 10){
                bdhtml=window.document.body.innerHTML;//获取当前页的html代码
                sprnstr="<!--startprint"+oper+"-->";//设置打印开始区域
                eprnstr="<!--endprint"+oper+"-->";//设置打印结束区域
                prnhtml=bdhtml.substring(bdhtml.indexOf(sprnstr)+30); //从开始代码向后取html
                prnhtml=prnhtml.substring(0,prnhtml.indexOf(eprnstr));//从结束代码向前取html
                window.document.body.innerHTML=prnhtml;
                window.print();
                window.document.body.innerHTML=bdhtml;
            } else {
                window.print();
            }
        }
    </script>
    <!--打印-->
</head>
<body>
    <div class="layui-tab">
        <form class="layui-form layui-form-pane" action="">
            <div class="mainBox">
                <div class="main-container">
                    <div class="main-container">
                        <fieldset class="layui-elem-field layui-field-title">
                            <legend><span title="打印" style="cursor: pointer">购买单 : ${saleOrder.saleOrderCode}</span></legend>
                        </fieldset>
                        <table cellspacing="0" cellpadding="0">
                            <tr>
                                <td colspan="4">支付方式:${saleOrder.paymanner}</td>
                            </tr>
                            <tr>
                                <td colspan="2">收银员:${emp}</td>
                                <td colspan="2">时间:${saleOrder.createDate}</td>
                            </tr>
                            <tr>
                                <td colspan="4">======================================================</td>
                            </tr>
                            <tr>
                                <td width="100px"></td>
                                <td width="150px">数量</td>
                                <td width="150px">单价</td>
                                <td width="150px">小计</td>
                            </tr>
                            <c:forEach items="${details}" var="od">
                                <tr>
                                    <td colspan="4" height="40px" style="line-height: 40px">${od.goodsName}</td>
                                </tr>
                                <tr>
                                    <td width="100px"></td>
                                    <td width="150px">${od.goodsCount}</td>
                                    <td width="150px">￥ ${od.goodsPrice}0 元</td>
                                    <td width="150px">￥ ${od.goodsstotlePrice}0 元</td>
                                </tr>
                            </c:forEach>
                            <tr>
                                <td colspan="4">======================================================</td>
                            </tr>
                            <tr>
                                <td colspan="2">件数:${saleOrder.saleGoodsCount}</td>
                                <td colspan="2">应付:￥ ${saleOrder.saleCopePrice}0 元</td>
                            </tr>
                            <tr>
                                <td colspan="2">优惠:￥ ${saleOrder.salePrePrice}0 元</td>
                                <td colspan="2">实收:￥ ${saleOrder.salePaidPrice}0 元</td>
                            </tr>
                        </table>
                    </div>
                </div>
            </div>
        </form>
        <!--打印内容结束-->
        <!--endprint1-->
    </div>
    <div class="bottom">
        <div class="button-container">
            <button  onclick=preview(1) style="margin-top: 6px" type="button" class="layui-btn layui-btn-normal layui-btn-sm" lay-submit="" lay-filter="user-save">
                <i class="layui-icon layui-icon-ok"></i>
                生成订单
            </button>
        </div>
    </div>
    <script>
        layui.use('element', function(){
            var element = layui.element;
        });
    </script>
   <script>
        layui.use(['form','jquery'],function(){
            let form = layui.form;
            let $ = layui.jquery;
            let m = 0;
            form.on('submit(user-save)', function(data){
            });
        })
    </script>
</body>
</html>